home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 48 / 048side1.d81 / bulls & bears (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  9KB  |  281 lines

  1. 0 gosub60100:print"[147]":x=rnd(-ti):poke53280,13:poke53281,1
  2. 5 print""spc(12)"bulls and bears[146]":print""
  3. 10 dimn$(20),d(20),p(20),c(20),p1(20),p2(20),sp(12),b(20),i$(9),s(20)
  4. 15 c=7:gosub980:print"[144]number of players (1/2)"
  5. 16 geta$:ifa$<"1"ora$>"2"then16
  6. 17 np=val(a$)
  7. 20 ifnp>2ornp<1thenprint"[145][145]":goto15
  8. 25 c=9:gosub980:print"[144]player 1 initials:";:al=1:nu=.:le=3:gosub60500:p1$=c$
  9. 30 iflen(p1$)<>3thenprint"[145][145][145]":goto25
  10. 35 ifnp=1then50
  11. 40 print:gosub980:print"player 2 initials:";:gosub60500:p2$=c$
  12. 45 iflen(p2$)<>3thenprint"[145][145][145]":goto40
  13. 50 yr=1:i3=6:m(1)=10000:m(2)=10000:pl=1
  14. 55 forx=1to12:readn$(x),d(x):p(x)=100:next
  15. 60 p(11)=120:forx=1to8:readi$(x):next:forx=13to20:readn$(x),p(x):next
  16. 65 print"[147]":s1=0:s2=0:forx=1to20:s1=s1+p1(x)*p(x):s2=s2+p2(x)*p(x):next
  17. 70 n1=int(m1*.02):n2=int(m2*.02)
  18. 75 ifm(1)<0thenn1=n1-int(m(1)*.02)
  19. 80 ifm(2)<0thenn2=n2-int(m(2)*.02)
  20. 85 m(1)=m(1)-n1+d1:m(2)=m(2)-n2+d2:t1=s1+m(1)-m1:t2=m(2)+s2-m2
  21. 90 print"  year:"yr"   quarter:"q:gosub1025
  22. 95 printtab(18)p1$:printtab(18)"[192][192][192]"
  23. 100 print"stocks"spc(15-len(str$(s1)))""s1
  24. 105 ifm(1)<0thenprint"[144]cash"spc(17-len(str$(m(1))))""m(1):goto115
  25. 110 print"[144]cash"spc(17-len(str$(m(1))))""m(1)
  26. 115 print"[144]dividends"spc(12-len(str$(d1)))""d1
  27. 120 print"[144]margins"spc(14-len(str$(m1)))""m1
  28. 125 print"[144]interest"spc(13-len(str$(n1)))""n1
  29. 130 printspc(15)"[144][192][192][192][192][192][192]":print"total"spc(16-len(str$(t1)))t1
  30. 135 ifnp=1then175
  31. 140 print""spc(30)"[144]"p2$:printspc(30)"[192][192][192]"
  32. 145 printspc(33-len(str$(s2)))""s2
  33. 150 ifm(2)<0thenprintspc(33-len(str$(m(2))))""m(2):goto160
  34. 155 printspc(33-len(str$(m(2))))""m(2)
  35. 160 printspc(33-len(str$(d2)))""d2
  36. 165 printspc(33-len(str$(m2)))""m2:printspc(33-len(str$(n2)))n2
  37. 170 printspc(27)"[144][192][192][192][192][192][192]":printspc(33-len(str$(t2)))t2
  38. 175 print:print:print"press space[146] to continue or q[146] to quit":poke198,0
  39. 180 geta$:ifa$=""then180
  40. 182 ifa$="q"then60000
  41. 185 ifa$<>chr$(32)then180
  42. 190 ifbr(1)=1orbr(2)=1then1105
  43. 195 ifyr=10andq=4then1105
  44. 200 print"[147]":gosub1090
  45. 205 ifen>9theny=y-1
  46. 210 ifen<-5theny=y+1
  47. 215 en=en+y:c1=y:gosub1090
  48. 220 ifi1>9theny=y-1
  49. 225 ifi1<-5theny=y+1
  50. 230 i1=i1+c1+y:c2=c1+y:gosub1090
  51. 235 ify=-2theny=0
  52. 240 i2=i2+c2+y:c3=c2+y:gosub1090:i3=i3+y:c4=y
  53. 245 ifi2<-6theni2=i2+1:c3=c3+1
  54. 250 ifi1-i3>2theni3=i3+1:c4=c4+1
  55. 255 ifi1-i3<-2theni3=i3-1:c4=c4-1
  56. 260 ifi3<2theni3=2:c4=0
  57. 265 ifi3<5theni1=i1+1:c2=c2+1
  58. 270 ifi3>12theni1=i1-1:c2=c2-1
  59. 275 d(12)=i3-2
  60. 280 ifd(12)<4thend(12)=4
  61. 285 ifd(12)>9thend(12)=9
  62. 290 gosub1100:c(1)=(c3-c4)*y:c(11)=-(10*c4)
  63. 295 ifp(11)>160thenc(11)=0
  64. 300 ifp(11)<70thenc(11)=c(11)+5
  65. 305 gosub1100:c(4)=(c2+c3)*y:gosub1100:c(5)=(c2+c3)*y-2
  66. 310 gosub1100:c(9)=c1*y*2:gosub1100:c(7)=(c3-c4-c1)*y
  67. 315 gosub1100:c(6)=c3*y:gosub1100:c(3)=-(c1+c4)*y*2
  68. 320 gosub1100:c(10)=(c2+c4)*y*2:gosub1100:c(2)=-(c2+c4)*y*2
  69. 325 gosub1100:c(8)=-c1*y:c(9)=c(9)+c1:c(10)=c(10)+(5*c2):gosub1100
  70. 330 ifi2>5thenc(4)=c(4)+y:c(7)=c(7)+y:c(6)=c(6)+y
  71. 335 ifi2<0thenc(4)=c(4)-y:c(7)=c(7)-(y*2):c(6)=c(6)-(y*2)
  72. 340 gosub1100
  73. 345 ifi3>10thenc(1)=c(1)-(2*y):c(2)=c(2)-(3*y):c(3)=c(3)-y
  74. 350 ifi3<5thenc(1)=c(1)+(2*y):c(2)=c(2)+(3*y):c(3)=c(3)+y
  75. 355 forx=1to10:y=int(rnd(1)*10)
  76. 360 ify>6theny=y-10
  77. 365 c(x)=c(x)+(2*y):next
  78. 370 forx=1to11
  79. 375 ifb(x)=1thenp(x)=100:b(x)=0
  80. 380 p(x)=p(x)+c(x)
  81. 385 ifp(x)=<0thenp(x)=0:b(x)=1
  82. 390 ifp(x)>199thenp(x)=int(p(x)/2):sp(x)=1
  83. 395 next
  84. 400 forx=1to10:ifsp(x)=0thennext:goto410
  85. 405 p1(x)=p1(x)*2:p2(x)=p2(x)*2:sp(x)=1:next
  86. 410 forx=13to(12+ip)
  87. 415 ifb(x)=0thennextx:goto430
  88. 420 ifb(x)=1thenb(x)=2
  89. 425 next
  90. 430 forx=13to(12+ip):gosub1090:p(x)=p(x)+y
  91. 435 ifp(x)>0thennext:goto450
  92. 440 ifb(x)=2thennext:goto450
  93. 445 p1(x)=0:p2(x)=0:p(x)=0:b(x)=1:next
  94. 450 q=q+1:ifq=5thenq=1:yr=yr+1
  95. 455 ifnp=1orpl=1then470
  96. 460 pl$=p2$:m=m(2):mt=m2:tl=m-mt
  97. 463 forx=1to20:s(x)=p2(x):tl=tl+s(x)*p(x):next
  98. 465 goto475
  99. 470 pl$=p1$:m=m(1):mt=m1:tl=m-mt
  100. 473 forx=1to20:s(x)=p1(x):tl=tl+s(x)*p(x):next
  101. 475 gosub1035:iftl<0thenbr(pl)=1
  102. 480 print"[147]":print"year:"yr" quarter:"q"    player: "pl$
  103. 485 print"[144]stk div prc chg   shrs [221]stk prc   shrs"
  104. 490 print"[192][192][192] [192][192][192] [192][192][192] [192][192][192]   [192][192][192][192] [221][192][192][192] [192][192][192]   [192][192][192][192]"
  105. 495 forx=1to12:y=len(str$(s(x))):y1=len(str$(p(x))):z=len(str$(c(x)))
  106. 500 print""n$(x)" "d(x)spc(4-y1)p(x)spc(3-z)c(x)spc(6-y)s(x)"[144][221]":next
  107. 505 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  108. 510 ifpl=2then585
  109. 515 ifq<>1oryr>8then525
  110. 520 gosub1030:nw=1:ip=ip+1:printspc(6)"new issue: "i$(ip)
  111. 525 forx=1to12+ip
  112. 530 ifb(x)<>1thennext:goto545
  113. 535 ifnw=0thengosub1030:nw=1
  114. 540 printspc(6)""n$(x)" declares bankruptcy":next
  115. 545 forx=1to11
  116. 550 ifsp(x)=0thennext:goto565
  117. 555 ifnw=othengosub1030:nw=1
  118. 560 printspc(6)""n$(x)" declares 2-for-1 split":sp(x)=0:next
  119. 565 ifnw=0then585
  120. 570 forx=1to3000:next
  121. 575 nw=0:l=15:gosub985
  122. 580 forx=1to6:printspc(5)"                               ":next
  123. 583 l=15:gosub985
  124. 585 print"[145]"spc(23)"[144][179]"
  125. 590 ifbr(pl)=1thenprint"  bankrupt[146]":print"[145]"spc(23)"[144][221]":goto605
  126. 595 ifmc>0thenprint:goto605
  127. 600 print" [144]b[146]uy    s[146]ell    e[146]xit   [221]"
  128. 605 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][178][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  129. 610 print"":print:print
  130. 615 forx=13to12+ip:y=len(str$(s(x))):z=9-len(str$(p(x)))
  131. 620 ifb(x)=2thennext:goto630
  132. 625 printspc(24)"[156]"n$(x)" "p(x)spc(z-y)s(x):next
  133. 630 l=10:gosub985:printspc(23)"[144][171][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  134. 635 printspc(26)" [129]indexes[146]"
  135. 640 printspc(24)" energy    "en:printspc(24)" economy   "i2
  136. 645 printspc(24)" interest  "i3:printspc(24)" inflation "i1
  137. 650 printspc(23)"[144][177][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  138. 655 print"cash="m:print"comm="cm:print"marg="mt
  139. 660 print"[145][145][145]"spc(15)"[144][221]":printspc(15)"[221]":printspc(15)"[221]"
  140. 665 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][177][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  141. 670 ifbr(pl)=0then680
  142. 675 forx=1to2000:next:goto1050
  143. 680 ifmc=0then700
  144. 685 l=15:gosub985:print" margin call:[146]"mc
  145. 690 print"[145]"spc(23)"[144][221]"
  146. 695 gosub825:mc=mc-x:ifmc>0thenprint"[145][145]"spc(14)"       ":goto685
  147. 700 fl=-1:poke198,.
  148. 701 print"";
  149. 702 if(fl)thenprint" [144]b[146]uy    s[146]ell    e[146]xit   "
  150. 705 ifnot(fl)thenprint" [144] uy     ell     xit   "
  151. 710 geta$:ifa$=""thenfl=not(fl):goto701
  152. 711 print" [144]b[146]uy    s[146]ell    e[146]xit   "
  153. 715 ifa$="b"thengosub735:goto701
  154. 720 ifa$="s"thengosub825:goto701
  155. 725 ifa$="e"then1050
  156. 730 fl=not(fl):goto701
  157. 735 gosub950:mr=0:printspc(21)"[144]buy on margin?":poke198,0
  158. 740 geta$:ifa$=""then740
  159. 745 ifa$="y"thenmr=1:goto755
  160. 750 ifa$<>"n"then740
  161. 755 gosub990:ifa$="x"thenreturn
  162. 760 ifmr=0then775
  163. 765 ifm-z/2<-1000thengosub955:gosub1020:goto765
  164. 770 mt=mt+int(z/2):m=m-int(z/2):goto785
  165. 775 ifm-z<-1000thengosub955:gosub1020:goto775
  166. 780 m=m-z:ifx=0then795
  167. 785 s(y)=s(y)+x
  168. 790 z=int(x*.1)+1:m=m-z:cm=cm+z+10
  169. 795 gosub950
  170. 800 printtab(7)"        "spc(4)"                    "
  171. 805 printtab(7)"        "spc(4)"                    "
  172. 810 printtab(7)"        "spc(4)"                    "
  173. 815 gosub950:print"cash="m:print"comm="cm:print"marg="mt
  174. 820 gosub890:gosub950:return
  175. 825 gosub990:ifa$="x"then845
  176. 830 ifx>s(y)thengosub960:gosub1020:goto830
  177. 835 m=m+z:s(y)=s(y)-x:gosub790
  178. 840 ifmt=0thengosub940:return
  179. 845 printspc(22)"[144]pay margin?":poke198,0
  180. 850 geta$:ifa$=""then850
  181. 855 ifa$="y"then870
  182. 860 ifa$="n"thengosub940:return
  183. 865 goto850
  184. 870 c=22:gosub980:print"amount:";:nu=1:al=.:le=8:gosub60500:x=val(c$)
  185. 875 ifm-x<-1000thengosub955:goto870
  186. 880 ifx>mtthenx=mt
  187. 885 m=m-x:mt=mt-x:goto795
  188. 890 z=len(str$(s(y)))
  189. 895 ify>12then915
  190. 900 ify=0thenreturn
  191. 905 l=y+1:gosub985:printspc(17)"     "
  192. 910 print"[145]"spc(22-z)s(y):return
  193. 915 l=y-11:forx=